<template>
    <div class="wrapper container" ref="id">
        <div class="head-title">
             <el-breadcrumb separator-class="el-icon-arrow-right">
                <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item>企业服务</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="height70"></div>
        <div v-for="(item,index) in newList" :key="index">
            <div class="list">
                <div class="list-item" v-for="son in item" :key="son.name">
                    <div class="item-icon"><img src="" alt=""></div>
                    <div class="item-title">{{son.name}}</div>
                    <div class="item-desc">{{son.desc}}</div>
                </div>
            </div>
        </div>
        <div class="height70"></div>
    </div>
</template>

<script>
export default {
    name: 'service',
    data () {
        return {
            list:[
                {  
                    name: '月嫂',
                    desc: '月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂月嫂' ,
                }, {   
                    name: '保姆',
                    desc: '保姆保姆保姆保姆保姆保姆保姆保姆保姆保姆保姆保姆保姆保姆保姆保姆保姆保姆保姆保姆' ,
                }, {   
                    name: '育儿嫂',
                    desc: '育儿嫂育儿嫂育儿嫂育儿嫂育儿嫂育儿嫂育儿嫂育儿嫂育儿嫂育儿嫂育儿嫂育儿嫂育儿嫂育儿嫂' ,
                
                }, {   
                    name: '油烟机清洗',
                    desc: '油烟机清洗油烟机清洗油烟机清洗油烟机清洗油烟机清洗油烟机清洗油烟机清洗油烟机清洗油烟机清洗' ,
                  
                }, {   
                    name: '住家陪护',
                    desc: '住家陪护住家陪护住家陪护住家陪护住家陪护住家陪护住家陪护住家陪护住家陪护住家陪护住家陪护' ,
               
                }, {   
                    name: '医院陪护',
                    desc: '医院陪护医院陪护医院陪护医院陪护医院陪护医院陪护医院陪护医院陪护医院陪护医院陪护医院陪护' ,
               
                }, {   
                    name: '保洁',
                    desc: '保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁保洁' ,
                   
                   
                }, {   
                    name: '钟点工',
                    desc: '钟点工钟点工钟点工钟点工钟点工钟点工钟点工钟点工钟点工钟点工钟点工钟点工钟点工钟点工钟点工' ,
                   
                } 
            ]
        }
    },
     mounted () {
         this.$refs.id.style.minHeight = window.innerHeight - 267 + 'px'
    },
    computed:{
       newList () {
           return this.group(this.list, 4)
       }
    },
    methods: {
        group (array, subGroupLength) {
            let index = 0;
            let newArray = [];

            while(index < array.length) {
                newArray.push(array.slice(index, index += subGroupLength));
            }
            return newArray;
        }
    }
}
</script>

<style lang="stylus" scoped>
    .wrapper
        margin-top 67px
    .list
        display: flex
        position relative
        justify-content space-between
        margin-bottom 76px;
        &:after
            position absolute
            content ''
            width 95%
            height 4px
            top 0
            bottom 0
            left 0
            right 0
            margin auto
            z-index -1
            background-color #6ba0f7
        .list-item
            width 238px
            box-shadow 0px 2px 9px 0px rgba(82, 135, 255, 0.41)
            padding 15px
            border-radius 10px
            background-color #ffffff
            box-sizing border-box
            transition .35s all
            cursor pointer;
            &:hover
                box-shadow 0px 10px 15px 1px rgba(82, 135, 255, 0.41)
            .item-icon
                margin auto
                margin-top -37px    
                width 45px
                height 45px
                background #eee
                border-radius 50%
                overflow hidden
                margin-bottom 10px
                img 
                    width 100%
                    height 100%
            .item-title
                font-size 20px
                color #282828
                margin-bottom 10px
                text-align center
            .item-desc
                color #838282
                font-size 14px
                line-height 17px
</style>

